import socket

HOST='localhost'
PORT=10000

def sendMessage(message):
    message=str(message)+'\r\n'
    print(message)
    #return
    sock=socket.socket()
    sock.connect((HOST,PORT))
    sock.send(message.encode())  
    response=b''
    chunk=sock.recv(1024);
    while chunk:
        response+=chunk
        chunk=sock.recv(1024)
    return response.decode()
if __name__=='__main__':
    test1Map={"code":1,"object":{"id":"zekdot","password":"123456"}}    #测试获取功能的json
    test2Map={"code":2,"object":{"id":"zekdot","password":"123456","things":[{"localId":1,"name":"python测试","addTime":"2018-11-18 21:35:45","endTime":"2018-11-18 21:31:45"}]}}   #测试添加功能的json
    test3Map={"code":3,"object":{"id":"zekdot","password":"123456","thingsId":[5]}} #测试删除功能的json
    #print(test1Map);
    print(sendMessage(test2Map))
